package com.huawei.security.service;

import com.huawei.security.model.User;
import com.huawei.security.repo.UserRepo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by minshiwu on 2017/2/26.
 */
@Service
public class UserService {
    @Autowired
    private UserRepo userRepo;

    @Transactional
    public User saveUser(String name, String passwd) {
        User user = new User();
        user.setName(name);
        user.setPasswd(passwd);
        return userRepo.save(user);
    }

    public User findByName(String name) {
        return userRepo.findByName(name);
    }

}
